package com.example.associationmanager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.associationmanager.bean.People;
import com.example.associationmanager.bean.PeopleAssociationVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PeopleMapper extends BaseMapper<People> {
    @Select("SELECT ap.people_number,ap.people_name,ap.people_gender,ap.people_age,ap.people_class,ap.people_phone,ap.people_rank,ap.people_status,ap.people_elses,ai.community_name\n" +
            "FROM association_people ap LEFT JOIN association_info ai\n" +
            "ON ap.`community_number`=ai.`community_number` WHERE ap.people_status=${status} AND ap.community_number=${communityNumber} LIMIT ${page*limit},${limit};")
    List<PeopleAssociationVo> getAllPeopleAssociation(@Param("page") Integer page,@Param("limit") Integer limit,@Param("status") Integer status,@Param("communityNumber") Integer communityNumber);//查询成员及所属社团信息

}
